<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="./plugins/elementui/index.css">
    <link rel="stylesheet" href="./plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="./css/style.css">
    <link rel="stylesheet" href="./css/orderset.css">
    <!-- 引入组件库 -->
    <script src="./js/vue.js"></script>
    <script src="./plugins/elementui/index.js"></script>
    <script type="text/javascript" src="./js/jquery.min.js"></script>
    <script src="./js/axios-0.18.0.js"></script>
    <link rel="stylesheet" href="css/login.css">

</head>
<body>
<div id="app">
    <div style="margin: auto">
<el-form ref="form"   :model="form" label-width="80px" class="logindiv">
    <el-form-item label="账号">
        <el-input name="username" v-model="form.username" style="width: 150px" size="small"></el-input>
    </el-form-item>
    <el-form-item label="密码">
        <el-input name="password" v-model="form.password" type="password" style="width: 150px" size="small"></el-input>
    </el-form-item>
    <el-form-item label="登入">
        <el-button @click="tologin">登入</el-button>
    </el-form-item>


</el-form>
    </div>
</div>

<script>
    new Vue({
        el: '#app',
        data: {

            form:{},




        },



        methods: {


            tologin() {
                axios({
                    headers: {
                        'Content-Type': 'application/json'
                    },

                    method: 'post',
                    url:'/doLogin',
                    data:{
                        username:this.form.username,
                        password:this.form.password
                    }

                }).then(res=>{
                    if (res.data.flag==true){
                        alert("slm")
                        location.href='/pages/main.html'
                    } else {
                        console.log(res.data)
                        alert(res.data.message)
                    }
                })
            }











        },

        created(){
            this.findAll()

        }


    })
</script>
</body>
</html>